Imports Microsoft.VisualBasic

Namespace MyMVC
    Public Class ViewerBase
        Inherits MVCComponent

        Protected Sub AddPleaseChooseItemToDDL(ByVal ddl As DropDownList)
            ddl.Items.Insert(0, MyObj.GetDDLPleaseChooseItem())
        End Sub

        Protected Sub AddPleaseSelectAllToDDL(ByVal ddl As DropDownList)
            ddl.Items.Insert(0, MyObj.GetDDLSelectAllItem())
        End Sub

        Public Sub New(ByVal dataInternal As TemplateControl)
            MyBase.New(dataInternal)
        End Sub

        Public Overrides ReadOnly Property VirtualPathExtension() As String
            Get
                Return ".Viewer"
            End Get
        End Property

        Public Overridable Sub ShowSuccessMessage(ByVal methodName As String)
            Dim key As String = String.Format("{0}.SuccessMessage", methodName)

            Me.ShowMessage(Me.GetLocalResourceObject(key))
        End Sub

        Public Overridable Sub ShowErrorMessage(ByVal methodName As String, ByVal ex As Exception)
            Dim key As String = String.Format("{0}.{1}ErrorMessage", methodName, ex.Message)

            If Me.GetLocalResourceObject(key) Is Nothing Then
                Throw ex
            Else
                Me.ShowMessage(Me.GetLocalResourceObject(key))
            End If

        End Sub

        Protected Sub ShowMessage(ByVal message As String)
            MyObj.ShowMessage(message)
        End Sub

        Protected Sub ShowMessage(ByVal format As String, ByVal ParamArray args() As String)
            MyObj.ShowMessage(format, args)
        End Sub
    End Class
End Namespace
